public class ArithmeticExercise1 {
    public static void main(String[] args) {
        //获取一个四位数的个位，十位，百位，千位
        int num = 8574;

        int ge = num % 10;
        System.out.println("ge = " + ge);
       // int shi = num / 10 % 10;
        int shi = num % 100 / 10;
        System.out.println("shi = " + shi);

        int bai = num / 100 % 10;
        System.out.println("bai = " + bai);

        int qian = num / 1000;
        System.out.println("qian = " + qian);

        System.out.println("==================");
        /*String str = num + "";//拼接  ""空字符串，得到 "8574"
        System.out.println("qian = " + str.charAt(0));
        System.out.println("bai = " + str.charAt(1));
        System.out.println("shi = " + str.charAt(2));
        System.out.println("ge = " + str.charAt(3));*/
    }
}
